<template>
  <div id="app">
    <Shopcart ref="shopcart" />
    <div class="summary">
      <!-- 通过ref设置的标识 获取子组件实例,进而调用子组件的方法 -->
      <span @click="$refs.shopcart.changeVisible()">购物车</span>
      <span>去结算</span>
    </div>
    <Child @click.native="handleChildClick"/>
  </div>
</template>

<script>
import Shopcart from './components/Shopcart.vue'
import Child from './components/Child.vue'

export default {
    components:{
      Shopcart,
      Child
    },
    methods:{
      handleChildClick(){
        console.log('点击了Child组件');
      }
    }
}
</script>

<style lang="scss">
*{
  margin: 0;
  padding: 0;;
}
.summary{
  position: fixed;
  bottom: 0;
  width: 100%;
  background-color: #555;
  color: white;
  display: flex;
  justify-content: space-between;
  padding: 10px 10px;
  box-sizing: border-box;
}
</style>
